<?php

$img = glob('public/upload/paginasite/'.$this->paginasite['PGS_ID'].'.*');
@$img = $img[0];

?>
<div id="bnn_pag" style="background-image: url('<?php echo $this->urlbase.'/'.$img; ?>'); ?>"></div>

<div id="ctn_blog">
    
    <div class="c_b_spc">
        
        <div class="c_b_ctd">
        <?php 
            foreach($this->result as $row) {
                
            // erro de troca de nome controller
            //if($blog['BLO_ID'] < 21)  $url = $_SERVER['HTTP_HOST'].''.$this->urlbase.'/blog/index/id/'.$blog['BLO_ID'];
            //else $url = $_SERVER['HTTP_HOST'].''.$this->urlbase.'/blogdapiti/index/id/'.$blog['BLO_ID'];        
                
            $url = $_SERVER['HTTP_HOST'].''.$this->urlbase.'/blog/index/id/'.$row['BLO_ID'];    
            $pos = strpos($url, 'www.');
            if ($pos === false) $url = 'http://www.'.$url;
            else $url = 'http://'.$url;
            
            $img = glob('public/upload/blog/'.$row['BLO_ID'].'.*');
            @$img = $img[0];
        ?>
            <div class="c_b_c_list">
                
                <div class="c_b_c_til">
                    <span class="c_b_c_dat"><?php echo Datetools::amd_dm($row['BLO_DAT'],'.'); ?></span>
                    <?php echo $row['BLO_NOM']; ?>
                </div>
                <?php if(strlen($img) > 0) { ?>
                <img src="<?php echo $this->urlbase.'/'.$img;?>" />
                <?php } ?>
                <div class="c_b_c_txt">
                    <?php echo nl2br($row['BLO_TXT']); ?>
                </div>
                
                <div class="c_b_c_rdp">
                    
                    <img src="<?php echo $this->urlbase.'/public/media/images/logo_pq.png'; ?>">
                    
                    <div class="c_b_c_r_post">
                        <div class="p_dat_hor">Postado em <?php echo Datetools::amd_dma($row['BLO_DAT'],'.'); ?></div>
                    </div>
                </div>
                
                <div class="c_b_c_fac">
                    <div id="fb-root"></div>
                    <script>(function(d, s, id) {
                       var js, fjs = d.getElementsByTagName(s)[0];
                       if (d.getElementById(id)) return;
                       js = d.createElement(s); js.id = id;
                       js.src = "//connect.facebook.net/pt_BR/sdk.js#xfbml=1&appId=688243397900389&version=v2.0";
                       fjs.parentNode.insertBefore(js, fjs);
                    }(document, 'script', 'facebook-jssdk'));</script>

                    <iframe src="//www.facebook.com/plugins/like.php?href=<?php echo urlencode($url); ?>&amp;width&amp;layout=standard&amp;action=like&amp;show_faces=false&amp;share=true&amp;height=35&amp;appId=688243397900389" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:700px; height:35px;" allowTransparency="true"></iframe>

                    <div class="fb-comments" data-href="<?php echo $url; ?>" data-width="700" data-numposts="5" data-colorscheme="light"></div>
                </div>
                
            </div> 
        <?php } ?>
        <?php echo $this->paginationControl($this->paginator, 'Sliding', 'pagination.phtml'); ?>
            
        </div>    

        <div class="c_b_sidebar">
            <div class="c_b_s_tags">
                <div class="c_b_s_til">TAGS</div>
                <?php echo $this->tags; ?>
            </div>
            
            <div class="c_b_s_fac">
                <?php echo $this->parametros['PAR_FACLKEBOX']; ?>
            </div>
        </div>
        
    </div>
</div>

<div class="bar-bottom"></div>